<?php

$id = $_GET['id'];

$data = $_POST;

$oldData =  file_get_contents('./db/data.txt');

$oldData = json_decode($oldData,true);

$oldData[$id]= $data;

file_put_contents('./db/data.txt',json_encode($oldData));

header("Location:./index.php");